import {createApp} from 'vue'
import {createPinia} from "pinia";
import App from './App.vue'
import 'xe-utils';

// demand component
import {iview_demand_component} from "@/config/iview_demand_component";
import {vxe_table_component} from "@/config/vxe_table_component";

// iview 样式
import 'view-ui-plus/dist/styles/viewuiplus.css';

// vxe-table样式
import 'vxe-table/lib/style.css';

// router
import router from "@/router/index";
// 引入自定义Loading

// 引入全局Message
import {Message, Modal} from "view-ui-plus";
import permission from "@/directives/permission";
import preventReClick from "@/directives/preventReClick";

const pinia = createPinia()
const app = createApp(App)
// 注册按钮权限指令
app.directive('perms', {
    mounted: (el, bindlings) => {
        permission(el, bindlings);
    }
})
app.directive('preventReClick', {
    mounted: (el, bindlings) => {
        preventReClick(el, bindlings);
    }
})
// 全局挂载Message
app.config.globalProperties.$Message = Message
app.config.globalProperties.$Modal = Modal
app.use(pinia)
app.use(router)
app.use(iview_demand_component)
app.use(vxe_table_component)
// app.use(CustomLoading);
app.mount('#app')

// 仅供全局使用loading
export default app
